//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Spreadsheet
{
    class CellAlignment: IOfficeXmlSerializable
    {
        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            using (ReadContext c = context.Read("alignment"))
            {
                HorizontalAlignment = c.GetOptionalEnum("horizontal", HorizontalCellAlignment.General);
                VerticalAlignment = c.GetOptionalEnum("vertical", VerticalCellAlignment.Top);
                TextRotation = c.GetOptionalInteger("textRotation", 0);
                WrapText = c.GetOptionalBoolean("wrapText", false);
                Indentation = c.GetOptionalInteger("indent", 0);
                RelativeIndentation = c.GetOptionalInteger("relativeIndent", 0);
                LastLineJustified = c.GetOptionalBoolean("justifyLastLine", false);
                ShrinkToFit = c.GetOptionalBoolean("shrinkToFit", false);
                MergeCell = c.GetOptionalBoolean("mergeCell", false);
                ReadingOrder = c.GetOptionalInteger("readingOrder", 0);

            }
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            using (WriteContext c = context.Write("alignment"))
            {
                c.SetOptionalEnum("horizontal", HorizontalAlignment, HorizontalCellAlignment.General);
                c.SetOptionalEnum("vertical", VerticalAlignment, VerticalCellAlignment.Top);
                c.SetOptionalInteger("textRotation", TextRotation, 0);
                c.SetOptionalBoolean("wrapText", WrapText, false);
                c.SetOptionalInteger("indent", Indentation, 0);
                c.SetOptionalInteger("relativeIndent", RelativeIndentation, 0);
                c.SetOptionalBoolean("justifyLastLine", LastLineJustified, false);
                c.SetOptionalBoolean("shrinkToFit", ShrinkToFit, false);
                c.SetOptionalBoolean("mergeCell", MergeCell, false);
                c.SetOptionalInteger("readingOrder", ReadingOrder, 0);
            }
        }

        #endregion
        private HorizontalCellAlignment _horizontalAlignment;

        public HorizontalCellAlignment HorizontalAlignment
        {
            get { return _horizontalAlignment; }
            set { _horizontalAlignment = value; }
        }
        private VerticalCellAlignment _verticalAlignemnt;

        public VerticalCellAlignment VerticalAlignment
        {
            get { return _verticalAlignemnt; }
            set { _verticalAlignemnt = value; }
        }
        private int _textRotation;

        public int TextRotation
        {
            get { return _textRotation; }
            set { _textRotation = value; }
        }
        private bool _wrapText;

        public bool WrapText
        {
            get { return _wrapText; }
            set { _wrapText = value; }
        }
        private int _indent;

        public int Indentation
        {
            get { return _indent; }
            set { _indent = value; }
        }
        private int _relativeIndent;

        public int RelativeIndentation
        {
            get { return _relativeIndent; }
            set { _relativeIndent = value; }
        }
        private bool justifyLastLine;

        public bool LastLineJustified
        {
            get { return justifyLastLine; }
            set { justifyLastLine = value; }
        }
        private bool _shrinkToFit;

        public bool ShrinkToFit
        {
            get { return _shrinkToFit; }
            set { _shrinkToFit = value; }
        }
        private bool _mergeCell;

        public bool MergeCell
        {
            get { return _mergeCell; }
            set { _mergeCell = value; }
        }
        private int _readingOrder;

        public int ReadingOrder
        {
            get { return _readingOrder; }
            set { _readingOrder = value; }
        }
	
	
	
	
	
	
	
	
	
	
    }
}
